#ifndef SETTINGS_DIALOG_H
#define SETTINGS_DIALOG_H

#include <settings.h>

#include <QtGui/QDialog>
#include <QtGui/QListWidget>
#include <QtGui/QStackedWidget>

namespace gui
{

class SettingsDialog : public QDialog
{
    Q_OBJECT

public:
    SettingsDialog(core::Settings* settings,
        bool isModal, QWidget* parent);
    ~SettingsDialog();

private:
    void createBasicLayout();
    void createPages();
    void connectSlots();

public slots:
    void accept();
    void reject();

private slots:
    void saveChanges();
    void clearChanges();

    void changePage(int index);

    void changeValue();

private:
    QHash<QWidget*, QPair<QString, QString> > m_controlToValueMapping;
    QHash<QWidget*, QVariant> m_pendingChanges;

    QPushButton* m_okButton;
    QPushButton* m_acceptButton;
    QPushButton* m_cancelButton;

    QListWidget* m_categories;
    QStackedWidget* m_pages;

    core::Settings* m_settings;
};

} // namespace gui

#endif
